import request from '/@/utils/request';

import qs from 'qs'


export function useCommonApi() {
	return {

		/**
		 * 查询文章列表
		 * @param params 
		 * @returns 
		 */
		articleList: (params: any) => {
			return request({
				url: 'COMMON-SERVICE/admin/article/articleList',
				method: 'get',
				params: params
			});
		},

		/**
		 * 修改文章信息
		 * @param params 
		 * @returns 
		 */
		updateArticle: (params: any) => {
			return request({
				url: 'COMMON-SERVICE/admin/article/updateArticle',
				method: 'post',
				data: params
			});
		},


		/**
		 * 添加文章分类
		 * @param params 
		 * @returns 
		 */
		addArticle: (params: any) => {
			return request({
				url: 'COMMON-SERVICE/admin/article/addArticle',
				method: 'post',
				data: params
			});
		},


		/**
		 * 获取图片列表
		 * @param params 
		 * @returns 
		 */
		getPhotoList: (params: any) => {
			return request({
				url: 'COMMON-SERVICE/admin/photo/getPhotoList',
				method: 'get',
				params: params
			});
		},


		/**
		 * 更新图片状态
		 * @param params 
		 * @returns 
		 */
		updatePhotoStatus: (params: any) => {
			let str = qs.stringify(params);
			return request({
				url: `COMMON-SERVICE/admin/photo/updatePhotoStatus?${str}`,
				method: 'post'
			});
		},

		/**
		 * 更新图片
		 * @param params 
		 * @returns 
		 */
		updatePhoto: (params: any) => {
			return request({
				url: `COMMON-SERVICE/admin/photo/updatePhoto`,
				method: 'post',
				data: params
			});
		},

		/**
		 * 添加图片
		 * @param params 
		 * @returns 
		 */
		addPhoto: (params: any) => {
			return request({
				url: `COMMON-SERVICE/admin/photo/addPhoto`,
				method: 'post',
				data: params
			});
		},


		/**
	 * 获取参数配置
	 * @param params 
	 * @returns 
	 */
		getParamConfig: (params: any) => {
			return request({
				url: '/GOLD-DOG-SERVICE/paramConfig/list',
				method: 'get',
				params: params
			});
		},

		/**
		 * 修改配置参数
		 * @param params 
		 * @returns 
		 */
		updateParamConfig: (params: any, code: any) => {
			return request({
				url: '/GOLD-DOG-SERVICE/paramConfig/updateParamConfig',
				method: 'post',
				data: params,
				headers: {
					"x-header-mfa-value": code
				}
			});
		},



	};
}
